const Path = require('path')
const {CleanWebpackPlugin} = require('clean-webpack-plugin')

const config = {
    entry:{
            win:'./src/win.js',
            node:'./src/node.js'
        },
    output:{
        path: Path.resolve(__dirname,'dist'),
        filename:'leechee.[name].js',
        library:'leechee',
        libraryTarget:'umd',
        globalObject:'this'
    },
    plugins:[
        new CleanWebpackPlugin(),
    ]
}
module.exports = (env,argv)=>{
    if(argv.mode === 'production'){
        config.output.filename = 'leechee.[name].min.js'
        config.plugins.shift()
    }
    return config
}